const fs = require('fs')
const zLib = require('zlib')

// 创建一个读数据的流
let readStream = fs.createReadStream('./src/1.txt')
    .pipe(zLib.createGzip())
    .pipe(fs.createWriteStream('./src/test/1.gzip'))

readStream.on('error', (err) => {
    if (err) {
        console.log('执行出错')
        console.log(err)
    }
})
